﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

namespace DFGK_WMS.Model.Models
{
    /// <summary>
    /// 收货单
    /// </summary>
    [SqlSugar.SugarTable(TableName = "TReceivingBills")]
    [Index(nameof(BillNo), IsUnique = true)]
    public partial class TReceivingBill
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        /// <summary>
        /// 单号
        /// </summary>
        public string BillNo { get; set; }
        /// <summary>
        /// 供应商Id
        /// </summary>
        public int? SupplierId { get; set; }
        /// <summary>
        /// 供应商名称
        /// </summary>
        public string SupplierName { get; set; }
        /// <summary>
        /// 状态：0-未开始；1-未完成；2-已完成 3-已提交
        /// </summary>
        public int Status { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateDate { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? BeginDate { get; set; }
        /// <summary>
        /// 完成时间
        /// </summary>
        public DateTime? EndDate { get; set; }
        /// <summary>
        /// 关联单号
        /// </summary>
        public string RefSn { get; set; }
        /// <summary>
        /// 收货人
        /// </summary>
        public string Receiver { get; set; }
        /// <summary>
        /// 库存地点
        /// </summary>
        public string StoLocation { get; set; }
        /// <summary>
        /// 总数量
        /// </summary>
        public decimal? TotalQty { get; set; }
        /// <summary>
        /// 总检查数量
        /// </summary>
        public decimal? TotalCheckQty { get; set; }
        /// <summary>
        /// 已检查数量
        /// </summary>
        public decimal? CheckedQty { get; set; }
        /// <summary>
        /// 是否已创建检查清单
        /// </summary>
        public bool? IsCreatedChecklist { get; set; }
        /// <summary>
        /// 检查类型
        /// </summary>
        public int? CheckType { get; set; }
        /// <summary>
        /// 检查结果
        /// </summary>
        public int? CheckResult { get; set; }
        /// <summary>
        /// 不合格原因
        /// </summary>
        public string Ngreason { get; set; }
        /// <summary>
        /// 库房Id
        /// </summary>
        public int? WarehouseId { get; set; }
        /// <summary>
        /// 库房编码
        /// </summary>
        public string WarehouseCode { get; set; }
        /// <summary>
        /// 库房名称
        /// </summary>
        public string WarehouseName { get; set; }


        /// <summary>
        /// 库区Id
        /// </summary>
        public int? AreaId { get; set; }

        /// <summary>
        /// 库区编号
        /// </summary>
        public string AreaCode { get; set; }

        /// <summary>
        /// 库区名称
        /// </summary>

        public string AreaName { get; set; }

        /// <summary>
        /// 总计
        /// </summary>
        public decimal TotalPrice { get; set; }



        /// <summary>
        /// 创建人Id
        /// </summary>
        public int? CreateUserId { get; set; }
        /// <summary>
        /// 创建人名称
        /// </summary>
        public string CreateUserName { get; set; }

        /// <summary>
        /// 已经收货数量
        /// </summary>
        [NotMapped]
        [SqlSugar.SugarColumn(IsIgnore =true)]
        public decimal? ReceivedQTY { get; set; }

        /// <summary>
        /// 收货单单详情
        /// </summary>
        [NotMapped]
        [SqlSugar.SugarColumn(IsIgnore = true)]
        public List<TReceivingBillDetail> BillDetailList
        {
            get; set;
        }

        /// <summary>
        /// 当前登陆人Id
        /// </summary>
        [NotMapped]
        [SqlSugar.SugarColumn(IsIgnore = true)]
        public int NowUserId { get; set; }

        /// <summary>
        /// 当前登陆人真实姓名
        /// </summary>
        [NotMapped]
        [SqlSugar.SugarColumn(IsIgnore = true)]
        public string NowUserRealName { get; set; }
    }
}
